<template>
  <el-row class="tac"
          style="height:100%;">
    <el-col :span="4"
            style="height:100%;background: #545C64"></el-col>
    <el-col :span="4"
            class="background"
            style=" position:fixed;height:100%;background: #545C64 ">
      <el-menu :default-active="active"
               :unique-opened="a"
               :router="b"
               class="el-menu-vertical-demo"
               @open="handleOpen"
               @close="handleClose"
               background-color="#545c64"
               text-color="#fff"
               active-text-color="#ffd04b">
        <el-menu-item index="/home">
          <i class="el-icon-menu"></i>
          <span slot="title">首页</span>
        </el-menu-item>
        <el-submenu index="2">
          <template slot="title">
            <i class="el-icon-document"></i>
            <span>数据管理</span>
          </template>
          <el-menu-item-group>
            <el-menu-item index="/home/userlist">用户列表</el-menu-item>
            <el-menu-item index="/home/shoplist">商家列表</el-menu-item>
            <el-menu-item index="/home/foodlist">食品列表</el-menu-item>
            <el-menu-item index="/home/orderlist">订单列表</el-menu-item>
            <el-menu-item index="/home/adminlist">管理员列表</el-menu-item>
          </el-menu-item-group>
        </el-submenu>
        <el-submenu index="3">
          <template slot="title">
            <i class="el-icon-plus"></i>
            <span>数据添加</span>
          </template>
          <el-menu-item-group>
            <el-menu-item index="/home/addshop">添加商铺</el-menu-item>
            <el-menu-item index="/home/addfood">添加食品</el-menu-item>
          </el-menu-item-group>
        </el-submenu>
        <el-submenu index="4">
          <template slot="title">
            <i class="el-icon-star-on"></i>
            <span>图表</span>
          </template>
          <el-menu-item-group>
            <el-menu-item index="/home/pie">用户分布</el-menu-item>
          </el-menu-item-group>
        </el-submenu>
        <el-submenu index="5">
          <template slot="title">
            <i class="el-icon-edit"></i>
            <span slot="title">编辑</span>
          </template>
          <el-menu-item-group>
            <el-menu-item index="/home/edit">文本编辑</el-menu-item>
          </el-menu-item-group>
        </el-submenu>
        <el-menu-item index="6">
          <i class="el-icon-setting"></i>
          <span slot="title">设置</span>
        </el-menu-item>
        <el-menu-item index="7">
          <i class="el-icon-info"></i>
          <span slot="title">说明</span>
        </el-menu-item>
        <el-menu-item index="8">
          <i class="el-icon-setting"></i>
          <span slot="title">导航四</span>
        </el-menu-item>
      </el-menu>
    </el-col>
    <el-col :span="20"
            style="overflow: hidden">
      <headerTop></headerTop>
      <keep-alive exclude="addfood,foodlist,addshop">
        <router-view></router-view>
      </keep-alive>
    </el-col>
  </el-row>
</template>
<script>
import headerTop from './headerTop.vue'
export default {
  components: {
    headerTop
  },
  data () {
    return {
      a: true,
      b: true,
      active: this.$route.path
    }
  },
  watch: {
    $route () {
      // console.log(this.active)
      this.active = this.$route.path
    }
  },
  methods: {
    handleOpen (key, keyPath) {
      console.log(key, keyPath)
    },
    handleClose (key, keyPath) {
      console.log(key, keyPath)
    }
  }
}
</script>

<style lang="less" scoped>
</style>
